package com.sx.zongzhi.adapter;


import android.content.Context;
import android.view.View;

import com.sx.zongzhi.R;
import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.List;

/**
 * Created by XZY on 2017/11/23.
 * 收件对象的adapter
 */
public class InObjectAdapter extends CommonAdapter<String> {

    private Context context;
    private List<String> mData;
    public InObjectAdapter(Context context, int layoutId, List<String> datas) {
        super(context, layoutId, datas);
        this.context=context;
        mData=datas;
    }

    @Override
    protected void convert(ViewHolder viewHolder, String item, final int position) {
        viewHolder.setText(R.id.tv_Name,item);
        viewHolder.setOnClickListener(R.id.imv_Delete, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mData.remove(position);
                notifyDataSetChanged();
            }
        });
    }
}
